package com.echo.code.arithmetic.chapter03;

/**
 * Created by baiyap on 2018/7/27
 */
public class Recursion {

  public static void main(String[] args) {
    long n = recursion(10);
    System.out.println(n);
  }

  private static long recursion(int x) {
    if (x < 0) throw new IllegalArgumentException("invalid parameter");
    if (x == 0) {
      return 1;
    }
    return x * recursion(x - 1);
  }
}
